﻿package mortal.game.view.mining
{
    import Framework.MQ.*;
    import Message.Command.*;
    import Message.Game.*;
    import Message.Public.*;
    import extend.language.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.net.broadCast.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.*;
    import mortal.game.view.task.data.*;
    import mortal.mvc.core.*;

    public class MiningCommand extends BroadCastCall
    {

        public function MiningCommand(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function call(param1:MessageBlock) : void
        {
            var _loc_2:STaskRoutineTaskRefreshInfo = null;
            var _loc_3:ColorInfo = null;
            var _loc_4:String = null;
            var _loc_5:TaskInfo = null;
            switch(param1.messageHead.command)
            {
                case EGateCommand._ECmdGateRoutineTaskPanelInfo:
                {
                    Cache.instance.mining.miningInfos = param1.messageBase as STaskRoutineTaskTaskInfo;
                    NetDispatcher.dispatchCmd(ServerCommand.MiningTaskInfosGot, null);
                    break;
                }
                case EGateCommand._ECmdGateRoutineTaskRefreshPanelInfo:
                {
                    Cache.instance.mining.miningRefreshInfos = param1.messageBase as STaskRoutineTaskOtherPlayersInfoList;
                    NetDispatcher.dispatchCmd(ServerCommand.MiningMemberInfosGot, null);
                    break;
                }
                case EGateCommand._ECmdGateRoutineTaskInviteInfo:
                {
                    Cache.instance.mining.addAskHelpList(param1.messageBase as STaskRoutineTaskOtherPlayersInfoList);
                    NetDispatcher.dispatchCmd(ServerCommand.MiningBeAskHelp, null);
                    break;
                }
                case EGateCommand._ECmdGateRoutineTaskUpdate:
                {
                    _loc_2 = param1.messageBase as STaskRoutineTaskRefreshInfo;
                    _loc_3 = ColorConfig.instance.getItemColor((_loc_2.color - 1));
                    _loc_4 = Language.getStringByParam(21039, _loc_2.name, _loc_3.color, _loc_3.colorText);
                    MsgManager.showRollTipsMsg(_loc_4);
                    _loc_5 = Cache.instance.task.getTaskByGroupInTaskCanget(ETaskGroup._ETaskGroupMinning)[0] as TaskInfo;
                    if (_loc_5 == null)
                    {
                        _loc_5 = Cache.instance.task.getTaskByGroupInTaskDoing(ETaskGroup._ETaskGroupMinning)[0] as TaskInfo;
                    }
                    if (_loc_5 != null)
                    {
                        GameProxy.task.getMiningAllTaskInfos(_loc_5.stask.code);
                    }
                    break;
                }
                case EGateCommand._ECmdGateRoutineTaskRefreshSuccess:
                {
                    MsgManager.showRollTipsMsg(Language.getString(21040));
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

    }
}
